using System;
using System.ComponentModel.DataAnnotations;

namespace JGSY.CMS.LowCode.Platform.Application.DTOs
{
    /// <summary>
    /// 表单数据传输对象
    /// 用于传输表单相关的数据信息，包括表单字段、验证规则、提交数据等
    /// </summary>
    public class FormDto
    {
        /// <summary>
        /// 表单ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 表单名称
        /// </summary>
        [Required(ErrorMessage = "表单名称不能为空")]
        [StringLength(255, ErrorMessage = "表单名称长度不能超过255个字符")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 表单标识符
        /// </summary>
        [Required(ErrorMessage = "表单标识符不能为空")]
        [StringLength(100, ErrorMessage = "表单标识符长度不能超过100个字符")]
        public string Identifier { get; set; } = string.Empty;

        /// <summary>
        /// 表单标题
        /// </summary>
        [StringLength(255, ErrorMessage = "表单标题长度不能超过255个字符")]
        public string? Title { get; set; }

        /// <summary>
        /// 表单描述
        /// </summary>
        [StringLength(500, ErrorMessage = "表单描述长度不能超过500个字符")]
        public string? Description { get; set; }

        /// <summary>
        /// 表单字段配置（JSON格式）
        /// </summary>
        public string? Fields { get; set; }

        /// <summary>
        /// 表单设置（JSON格式）
        /// </summary>
        public string? Settings { get; set; }

        /// <summary>
        /// 验证规则（JSON格式）
        /// </summary>
        public string? ValidationRules { get; set; }

        /// <summary>
        /// 提交成功消息
        /// </summary>
        [StringLength(500, ErrorMessage = "提交成功消息长度不能超过500个字符")]
        public string? SuccessMessage { get; set; }

        /// <summary>
        /// 提交失败消息
        /// </summary>
        [StringLength(500, ErrorMessage = "提交失败消息长度不能超过500个字符")]
        public string? ErrorMessage { get; set; }

        /// <summary>
        /// 重定向URL
        /// </summary>
        [StringLength(500, ErrorMessage = "重定向URL长度不能超过500个字符")]
        public string? RedirectUrl { get; set; }

        /// <summary>
        /// 邮件通知配置（JSON格式）
        /// </summary>
        public string? EmailNotification { get; set; }

        /// <summary>
        /// 是否需要登录才能提交
        /// </summary>
        public bool RequireLogin { get; set; }

        /// <summary>
        /// 是否启用验证码
        /// </summary>
        public bool EnableCaptcha { get; set; }

        /// <summary>
        /// 是否允许多次提交
        /// </summary>
        public bool AllowMultipleSubmissions { get; set; }

        /// <summary>
        /// 每日提交限制
        /// </summary>
        public int? DailySubmissionLimit { get; set; }

        /// <summary>
        /// 总提交限制
        /// </summary>
        public int? TotalSubmissionLimit { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 提交次数
        /// </summary>
        public int SubmissionCount { get; set; }

        /// <summary>
        /// SEO标题
        /// </summary>
        [StringLength(255, ErrorMessage = "SEO标题长度不能超过255个字符")]
        public string? SeoTitle { get; set; }

        /// <summary>
        /// SEO关键词
        /// </summary>
        [StringLength(500, ErrorMessage = "SEO关键词长度不能超过500个字符")]
        public string? SeoKeywords { get; set; }

        /// <summary>
        /// SEO描述
        /// </summary>
        [StringLength(500, ErrorMessage = "SEO描述长度不能超过500个字符")]
        public string? SeoDescription { get; set; }

        /// <summary>
        /// 自定义属性
        /// </summary>
        public string? CustomFields { get; set; }

        /// <summary>
        /// 排序权重
        /// </summary>
        public int SortOrder { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public byte Status { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        public int Version { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public long CreatedBy { get; set; }

        /// <summary>
        /// 修改人ID
        /// </summary>
        public long? UpdatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 创建人姓名
        /// </summary>
        public string? CreatorName { get; set; }

        /// <summary>
        /// 修改人姓名
        /// </summary>
        public string? UpdaterName { get; set; }

        /// <summary>
        /// 表单状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 是否活跃（在时间范围内且状态正常）
        /// </summary>
        public bool IsActive { get; set; }
    }
}
